<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: upcoming_products.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

$module_smarty = new Smarty;
$module_smarty->assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');

require_once (DIR_FS_INC.'inc.date_short.php');
$module_content = array ();

if ($_SESSION['customers_status']['customers_fsk18_display'] == '0')
	$fsk_lock = ' and p.products_fsk18!=1';

if (GROUP_CHECK == 'true')
	$group_check = "and p.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";

$expected = $db->db_query_limit("SELECT
										p.products_id,
										p.products_image,
										p.products_price,
										p.products_tax_class_id,
										p.products_model,
										p.products_quantity,
										p.products_date_available,
										pd.products_name,
										pd.products_short_description
									FROM
										".TABLE_PRODUCTS." p,
										".TABLE_PRODUCTS_DESCRIPTION." pd
									WHERE
										TO_DAYS(products_date_available) >= TO_DAYS(now())
									AND
										p.products_id = pd.products_id
										".$group_check."
										".$fsk_lock."
									AND
										pd.language_id = '".(int) $_SESSION['languages_id']."'
									ORDER BY
										p.products_date_available ".EXPECTED_PRODUCTS_SORT, MAX_DISPLAY_UPCOMING_PRODUCTS);

if($expected->_numOfRows) {
	$list_data = get_list_data('upcoming_product');
	$row = 0;
	while(!$expected->EOF) { $row++;
		$module_content[] = $product->buildDataArray($expected->fields, 'thumbnail', $list_data, $row);
		$expected->MoveNext();
	}

	$module_smarty->assign('language', $_SESSION['language']);
	$module_smarty->assign('module_content', $module_content);
	$module_smarty->assign('TITLE', UPCOMING_PRODUCT);
	$module_smarty->assign('LIST_NAME', 'upcomming_product');
	if($list_data['col']>1)
		$module_smarty->assign('CLASS_NAME', 'grid');
	else
		$module_smarty->assign('CLASS_NAME', 'list');
	$module_smarty->caching = false;
	$module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/'.$list_data['list_file'].'.html');

	$default_smarty->assign('MODULE_upcoming_products', $module);
}
?>